<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>数据操作</title>
    <script type="text/javascript" th:src="@{/js/jquery-3.6.0.min.js}"></script>
    <script src="https://g.alicdn.com/dingding/dingtalk-jsapi/3.0.25/dingtalk.open.js"></script>
    <style>
    </style>
    <script type="text/javascript" th:src="@{/js/authLogin.js}"></script>
</head>

<body>

<div style="text-align: center">

    <p>导入时需先下载模板</p>
    <P>名称为必填项和钉钉昵称一致日，日期格式为 yyyy-MM-dd</P>
    <P>打卡时间格式为 yyyy-MM-dd HH:mm:ss 或 HH:mm:ss</P>
    <P>模式为原有记录上追加（相同日期不覆盖）</P>
    <P>加班时长自动计算，非必填</P>
    <P> 模板点击：<a th:href="@{/attend/exportExcel(userName = 'xxxxxx')}" download="exported_data.xlsx">模板下载</a></P>
    <P> 导出记录：<a id = "recordDownload" download="exported_data.xlsx">记录下载</a></P>
    <form method="post" enctype="multipart/form-data" th:action="@{/attend/importExcel}">
        <input type="file" name="file">
        <input type="text" id = "textName" name="userName" value="xxxxxx" style="display: none">
        <input type="submit" value="点击导入">
    </form>
    <p th:text="${msg}"></p>
</div>
<script th:inline="javascript">
    window.onload = function() {
        checkLogin('');
        let userInfo = getUserInfo();
        var userName = userInfo.userName;
        var inputName = document.getElementById("textName");
        inputName.value = userName;
        var downLoad = document.getElementById("recordDownload");
        downLoad.href = "/attend/exportExcel?userName=" + userName;
    };
</script>
</body>

</html>